<!DOCTYPE html>
<html lang="en">
	<head>
		<title>nCaptcha: One more quick check.</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<meta name="robots" content="noindex, nofollow" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta name="description" content="nCaptcha: Bot Prevention System" />
		<style>
			html {
				color: white;
				background-color: black;
				font-family: sans-serif;
			}
		</style>
		<script src="/captcha/libWeb.js"></script>
		<script src="/captcha/libCaptcha.js"></script>
		<script src="/captcha/blowfish.js" defer="defer"></script>
		<script src="/captcha/xxtea.js" defer="defer"></script>
		<script src="/captcha/sha256.js" defer="defer"></script>
		<div version="3.3">
			<div style="position: fixed; bottom: 0px; right: 10px; opacity: 0.4; z-index: 99; text-align: right; pointer-events: none">
				<p style="margin-top: 5px; margin-bottom: 5px">
					<span>&#110;&#67;&#97;&#112;&#116;&#99;&#104;&#97;&#32;&#51;&#46;&#51;</span>
				</p>
			</div>
		</div>
	</head>
	<body>
		<style>
			#v {
				position: absolute;
				top: 40%;
				left: 50%;
				transform: translateX(-50%) translateY(-50%);
				text-align: center;
			}
			.form {
				opacity: 0;
				width: 0px;
				height: 0px;
				pointer-events: none;
			}
			.poly-item {
				padding-left: 5px;
				box-shadow: 0 14px 28px rgba(255, 255, 255, 0.11), 0 10px 10px rgba(255, 255, 255, 0.08);
				border: 1px solid white;
				margin-bottom: 10px;
			}
			#nc2_captcha_input:disabled {
				cursor: not-allowed !important;
			}
			#nc2_captcha_submit:disabled {
				cursor: not-allowed !important;
			}

			.spinner {
				width: 20px;
				aspect-ratio: 1;
				border-radius: 50%;
				border: 4px solid #514b82;
				animation: s1 0.8s infinite linear alternate, s2 1.6s infinite linear;
			}
			@keyframes s1 {
				0% {
					clip-path: polygon(50% 50%, 0 0, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%);
				}
				12.5% {
					clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%);
				}
				25% {
					clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 100%, 100% 100%, 100% 100%);
				}
				50% {
					clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100%);
				}
				62.5% {
					clip-path: polygon(50% 50%, 100% 0, 100% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100%);
				}
				75% {
					clip-path: polygon(50% 50%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 50% 100%, 0% 100%);
				}
				100% {
					clip-path: polygon(50% 50%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 0% 100%);
				}
			}
			@keyframes s2 {
				0% {
					transform: scaleY(1) rotate(0deg);
				}
				49.99% {
					transform: scaleY(1) rotate(135deg);
				}
				50% {
					transform: scaleY(-1) rotate(0deg);
				}
				100% {
					transform: scaleY(-1) rotate(-135deg);
				}
			}
		</style>
		<div id="v" style="width: 50vh">
			<h2>We quickly need to check if you are a robot or not.</h2>
			<noscript>
				<form action="/captcha/legacy_captcha_submit">
					<img src="captcha/generate_captcha_fallback&source=imgID" alt="Images are required." decoding="async" loading="lazy" text-disb="Accessibility options coming soon!" style="image-rendering: pixelated; width: 100%" />
					<br />
					Text: <input type="text" name="value" value="" style="background-color: inherit; color: inherit; border: 1px solid lightgray; font-family: inherit; padding: 5px" autocomplete="off" aria-autocomplete="none" /><br />
					<input type="submit" value="Submit" style="background-color: inherit; color: inherit; border: 1px solid lightgray; font-family: inherit; padding: 5px" />
				</form>
			</noscript>
			<div id="ncaptcha3" style="display: none; visibility: hidden">
				<button id="ncaptcha3_button" style="background-color: inherit; color: inherit; border: 1px solid lightgray; font-family: inherit; padding: 5px">Are you a robot?</button>
				<p id="ncaptcha3_subtext" style="font-size: small; font-family: monospace">Press the button above.</p>
				<form id="form" class="form" method="POST" action="/captcha/signup_submit_form">
					<label id="form-first-name" id="name">Name: </label>
					<input type="text" name="name" id="form-first-name" required value="" autocomplete="off" aria-autocomplete="none" />
					<label for="form-second-name" id="name2">Surname: </label>
					<input type="text" name="name2" id="form-second-name" required value="" autocomplete="off" aria-autocomplete="none" />
					<label id="email" for="form-email">Email: </label>
					<input type="email" name="email" id="form-email" required value="" autocomplete="off" aria-autocomplete="none" />
					<button id="form-button">Submit</button>
				</form>
				<script defer="defer">
					/* Constants */
					const NC_ALLOW_V4_CHALLENGES = false;
					const NCAPTCHA_ERROR_LOOKUP_HEADER = {
						NCAPTCHA_MISSING_COOKIE: "nCaptcha encountered an issue.",
					};
					const NCAPTCHA_ERROR_LOOKUP_TEXT = {
						NCAPTCHA_MISSING_COOKIE: "Your browser seems to have not set or provided the required cookie, this typically is a browser related issue.",
					};
					/* Logic */

					function hasError(jsonObject) {
						return jsonObject && jsonObject["error"] && jsonObject["reason"];
					}

					if (!String.prototype.contains) {
						String.prototype.contains = function (str) {
							return this.indexOf(str) > -1;
						};
					}

					function loadScript(url, callback) {
						if (url.endsWith(".css")) {
							var style = document.createElement("style");
							style.src = url;
							if (style.onreadystatechange) style.onreadystatechange = callback;
							style.onload = callback;
							document.head.appendChild(style);
						} else {
							var script = document.createElement("script");
							script.type = "text/javascript";
							script.src = url;
							script.onreadystatechange = callback;
							script.onload = callback;
							document.head.appendChild(script);
						}
					}

					function __do_error_mtrx(err, ver, reason) {
						id("-nc3-error-div").style.display = "";
						id("-nc3-error-div").style.visibility = "";

						if (reason !== null) {
							id("-nc3-error-header").innerText = NCAPTCHA_ERROR_LOOKUP_HEADER[reason];
							id("-nc3-error-text").innerText = NCAPTCHA_ERROR_LOOKUP_TEXT[reason];
						}

						loadScript("/captcha/datamatrix.js", function () {
							const _msg = {
								version: ver,
								format: 1,
								error: err.stack || err.stacktrace || "",
								time: Date.now(),
							};
							const _errSvg = DATAMatrix({
								msg: JSON.stringify(_msg),
								pal: ["#000000", "#f2f4f8"],
							});
							id("-nc3-error-img").appendChild(_errSvg);
						});
					}

					function getQueryVariable(variable) {
						var query = window.location.search.substring(1);
						var vars = query.split("&");
						for (var i = 0; i < vars.length; i++) {
							var pair = vars[i].split("=");
							if (decodeURIComponent(pair[0]) == variable) {
								return decodeURIComponent(pair[1]);
							}
						}
						return null;
					}

					function base64Decode(str) {
						try {
							return decodeURIComponent(
								Array.prototype.map
									.call(atob(str), function (c) {
										return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
									})
									.join("")
							);
						} catch (ex) {
							return atob(str);
						}
					}

					function base64Encode(str) {
						try {
							return btoa(
								encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
									return String.fromCharCode(parseInt(p1, 16));
								})
							);
						} catch (ex) {
							return btoa(str);
						}
					}
					function base64ToArrayBuffer(base64) {
						const binaryString = base64Decode(base64);
						const _bytes = new Uint8Array(binaryString.length);
						for (var i = 0; i < binaryString.length; i++) {
							_bytes[i] = binaryString.charCodeAt(i);
						}
						return _bytes;
					}
					function ab2str(buf) {
						return String.fromCharCode.apply(null, new Uint8Array(buf));
					}

					function str2ab(str) {
						var buf = new ArrayBuffer(str.length);
						var bufView = new Uint8Array(buf);
						for (var i = 0, strLen = str.length; i < strLen; i++) {
							bufView[i] = str.charCodeAt(i);
						}
						return buf;
					}

					function str2u8(str) {
						var buf = new ArrayBuffer(str.length);
						var bufView = new Uint8Array(buf);
						for (var i = 0, strLen = str.length; i < strLen; i++) {
							bufView[i] = str.charCodeAt(i);
						}
						return bufView;
					}

					function date2str(x, y) {
						var z = {
							M: x.getMonth() + 1,
							d: x.getDate(),
							h: x.getHours(),
							m: x.getMinutes(),
							s: x.getSeconds(),
						};
						y = y.replace(/(M+|d+|h+|m+|s+)/g, function (v) {
							return ((v.length > 1 ? "0" : "") + z[v.slice(-1)]).slice(-2);
						});

						return y.replace(/(y+)/g, function (v) {
							return x.getFullYear().toString().slice(-v.length);
						});
					}
					id("ncaptcha3_button").onclick = function (event) {
						const but = id("ncaptcha3_button");
						const st = id("ncaptcha3_subtext");
						but.disabled = true;
						but.innerHTML = "Proving that you are not a robot...";
						st.innerHTML = "This will take a moment.";
						const context = {};
						context["gyro"] = typeof Gyroscope === "function" && "WebSocket" in window && window.WebSocket.CLOSING === 2 && NC_ALLOW_V4_CHALLENGES;
						request(
							"/captcha/request_auto",
							JSON.stringify(context),
							function (e) {
								console.error(e);
								__do_error_mtrx(e, 3, null);
								but.disabled = true;
								but.innerHTML = "Are you a robot?";
								st.innerHTML = "Press the button above.";
							},
							function (data) {
								const obj = JSON.parse(data);
								if (hasError(obj)) {
									const errorReason = obj["reason"];
									__do_error_mtrx(new Error(errorReason), 3, errorReason);
								} else {
									run_async(function () {
										try {
											var scr = document.createElement("script");
											var decrypted_mathChallenge = null;
											switch (obj.cipher) {
												case "blowfish": {
													scr.innerHTML = blowfish.decrypt(obj.payload, obj.key, { cipherMode: 0, outputType: 0 });
													decrypted_mathChallenge = blowfish.decrypt(obj.math_payload, obj.key, { cipherMode: 0, outputType: 0 });
													break;
												}
												case "xtea": {
													scr.innerHTML = XXTEA.decryptFromBase64(obj.payload, obj.key);
													decrypted_mathChallenge = XXTEA.decryptFromBase64(obj.math_payload, obj.key);
													break;
												}
												default:
													throw new Error("E:CIPHER_UNKNOWN");
											}
											document.head.appendChild(scr);
											const result = window.nCaptchaAuto.payload(obj.key, obj.cipher, {
												mathChallenge: decrypted_mathChallenge,
												safetyHash: obj["safety_hash"],
												event: event,
											});
											window.nCaptchaAuto = {};
											delete window.nCaptchaAuto;
											delete window.XXTEA;
											document.head.removeChild(scr);
											/* */
											/* */
											but.innerHTML = "Sending data...";
											request(
												"/captcha/auto_submit",
												result["value"],
												function (e1) {
													console.error(e1);
													__do_error_mtrx(e1, 2, null);
													but.disabled = false;
													but.innerHTML = "Are you a robot?";
													st.innerHTML = "Press the button above.";
												},
												function (resp) {
													const rj1 = JSON.parse(resp);
													st.innerHTML = "Press the button above.";
													if (rj1["passed"]) {
														but.innerHTML = "You aren't a robot.";
														var to = getQueryVariable("redir");
														if (to == null) {
															try {
																window.location.reload();
															} catch (e) {
																window.location.href = window.location.href;
															}
														} else {
															window.location = to;
														}
													} else {
														but.innerHTML = "We're not sure still, trying another challenge.";
														id("ncaptcha2").style.display = "";
														id("ncaptcha2").style.visibility = "";
														window.setTimeout(function () {
															nc2_create_captcha();
														}, 1500);
													}
												},
												{
													"X-NCAPTCHA-HASH": result["hash"],
												}
											);
										} catch (_error) {
											console.error(_error);
											__do_error_mtrx(_error, 3, null);
										}
									});
								}
							}
						);
					};
				</script>
			</div>
			<div id="ncaptcha2" style="display: none; visibility: hidden; border: 1px solid blue; width: 30rem; margin: auto">
				<div id="nc2_tid_249924" style="display: none; visibility: hidden; padding-bottom: 5px; overflow: hidden">
					<img id="nc2_captcha" src="" alt="Loading captcha... JS is required." loading="lazy" decoding="async" style="image-rendering: pixelated; width: 100%" />
					<div id="nc4_captcha_ph" style="display: none; visibility: hidden"></div>
					<div>
						<div id="nc2_spinner" class="spinner" style="display: inline-block; vertical-align: middle"></div>
						<p id="nc2_instructions" style="font-family: sans-serif; text-align: center; display: inline-block">Waiting for captcha via JS...</p>
					</div>
					<input style="display: inline-block; width: 65%; color: inherit; background-color: inherit; border: 1px solid lightgray; font-family: inherit; padding: 5px" id="nc2_captcha_input" value="" />
					<input id="nc2_captcha_submit" onclick="nc2_verify();" type="submit" value="Submit" style="background-color: inherit; color: inherit; border: 1px solid lightgray; font-family: inherit; padding: 5px" />
					<script>
						function nc2_create_captcha() {
							request(
								"/captcha/generate_captcha",
								null,
								function (exception) {
									console.error(exception);
									__do_error_mtrx(exception, 2, null);
								},
								function (data) {
									const c2json = JSON.parse(data);
									if (hasError(c2json)) {
										const errorReason0 = c2json["reason"];
										id("nc2_tid_249924").style.display = "none";
										id("nc2_tid_249924").style.visibility = "hidden";
										__do_error_mtrx(new Error(errorReason0), 2, errorReason0);
									} else {
										id("nc2_captcha").src = c2json.image;
										id("nc2_spinner").style.display = "none";
										id("nc2_spinner").style.visibility = "hidden";
										var t = c2json["type"];
										var uuid = c2json["uuid"];
										/* TODO: Convert this into a switch. */
										if (t === "type:screenwords" || t === "type:multiword") {
											id("nc2_instructions").innerHTML = "Enter the letters above.";
										} else if (t === "type:screenwords2" || t === "type:screenwords3") {
											id("nc2_instructions").innerHTML = "Enter the OUTLINED letters above.";
										} else if (t === "type:captcha_done") {
											id("nc2_instructions").innerHTML = "You aren't a robot.";
											var to = getQueryVariable("redir");
											if (to == null) {
												try {
													window.location.reload();
												} catch (e) {
													window.location.href = window.location.href;
												}
											} else {
												window.location = to;
											}
											return;
										} else if (t === "type:shapes") {
											id("nc2_instructions").innerHTML = "Enter the shape above.";
										} else if (t === "type:messedup") {
											id("nc2_instructions").innerHTML = "Enter the second half, then the first half of the word above.";
										} else if (t === "type:math") {
											id("nc2_instructions").innerHTML = "Enter the answer to the math question.";
										} else if (t === "type:objectid") {
											id("nc2_instructions").innerHTML = "Enter the item in the above image.";
										} else if (t === "type:truefalse") {
											id("nc2_instructions").innerHTML = "Is this statement TRUE or FALSE?";
										} else if (t === "type:multiword") {
											id("nc2_instructions").innerHTML = "Enter the 'words' above.";
										} else if (t === "type:v4-gryo") {
											__do_v4_gyro(uuid);
										} else if (t === "type:bot_detected") {
											id("nc2_instructions").innerHTML = "Are you a robot? We'll try again in a moment.";
											id("nc2_captcha_input").disabled = true;
											id("nc2_captcha_submit").disabled = true;
											window.setTimeout(function () {
												id("nc2_captcha_input").disabled = false;
												id("nc2_captcha_submit").disabled = false;
												nc2_create_captcha();
											}, 1000 * 120);
										} else {
											__do_error_mtrx(new Error("ERR_CHALLENGE: Unknown challenge type: " + t), 3, null);
											id("nc2_captcha_input").disabled = true;
											id("nc2_captcha_submit").disabled = true;
										}
									}
								}
							);
						}
						function nc2_verify() {
							const b = id("nc2_captcha_input");
							b.disabled = true;
							id("nc2_captcha_submit").disabled = true;
							id("nc2_spinner").style.display = "inline-block";
							id("nc2_spinner").style.visibility = "";
							const v = id("nc2_instructions");
							v.innerHTML = "Checking...";
							const m = b.value;
							var s = {};
							s["value"] = m;
							b.value = "";
							request(
								"/captcha/check_captcha",
								JSON.stringify(s),
								function (ex0) {
									console.error(ex0);
									__do_error_mtrx(ex0, 2, null);
								},
								function (r) {
									const rj = JSON.parse(r);
									id("nc2_spinner").style.display = "none";
									id("nc2_spinner").style.visibility = "hidden";
									if (rj["result"] === "passed") {
										v.innerHTML = "You aren't a robot.";
										var to = getQueryVariable("redir");
										if (to == null) {
											try {
												window.location.reload();
											} catch (e) {
												window.location.href = window.location.href;
											}
										} else {
											window.location = to;
										}
									} else {
										v.innerHTML = "Captcha failed, trying again.";
										b.disabled = false;
										b.value = "";
										id("nc2_captcha_submit").disabled = false;
										window.setTimeout(function () {
											nc2_create_captcha();
										}, 1500);
									}
								}
							);
						}
						function __do_v4_gyro(uuid) {
							id("nc2_instructions").innerHTML = "Preparing your challenge...";
							const socket = new WebSocket("ws://" + location.host.toString() + "/captcha/gyro");
							const gyroscope = new Gyroscope({ frequency: 10 });
							const progressBar = document.createElement("div");
							progressBar.style.width = "100%";
							progressBar.style.height = "64px";
							progressBar.style.backgroundColor = "wheat";
							id("nc4_captcha_ph").appendChild(progressBar);
							id("nc4_captcha_ph").style.display = "";
							id("nc4_captcha_ph").style.visibility = "";
							id("nc2_captcha").style.display = "none";
							id("nc2_captcha").style.visibility = "hidden";
							gyroscope.addEventListener("reading", function (e) {
								const __dataObj = {};
								__dataObj["x"] = gyroscope.x;
								__dataObj["y"] = gyroscope.y;
								__dataObj["z"] = gyroscope.z;
								__dataObj["uuid"] = uuid;
								socket.send(JSON.stringify(__dataObj));
							});
							socket.addEventListener("open", function (event) {
								gyroscope.start();
								id("nc2_instructions").innerHTML = "Move your device around until the bar is empty.";
							});
							socket.addEventListener("error", function (event) {
								console.error("v4-gyro", event);
								__do_error_mtrx(event, 4, null);
								socket.close();
								gyroscope.stop();
							});
							socket.addEventListener("message", function (event) {
								const respObj = JSON.parse(event.data);
								if (respObj["ok"]) {
									socket.close();
									gyroscope.stop();
									id("nc2_instructions").innerHTML = "You aren't a robot.";
									var to = getQueryVariable("redir");
									if (to == null) {
										try {
											window.location.reload();
										} catch (e) {
											window.location.href = window.location.href;
										}
									} else {
										window.location = to;
									}
								} else {
									const respBar = respObj["bar"];
									const respBarV = respBar < 0 ? -respBar : respBar;
									progressBar.style.width = respBarV + "%";
									if (respBarV > 70) {
										progressBar.style.backgroundColor = "red";
									} else if (respBarV > 50) {
										progressBar.style.backgroundColor = "orangered";
									} else if (respBarV > 30) {
										progressBar.style.backgroundColor = "green";
									} else {
										progressBar.style.backgroundColor = "darkgreen";
									}
								}
							});
						}
					</script>
				</div>
			</div>
			<p style="font-size: small; display: none; visibility: hidden">nCaptcha 3.x</p>
			<script defer="defer">
				id("ncaptcha3").style.display = "";
				id("ncaptcha3").style.visibility = "";
				id("nc2_tid_249924").style.display = "";
				id("nc2_tid_249924").style.visibility = "";
			</script>
			<div id="-nc3-error-div" class="poly-item" style="border-color: red; text-align: left !important; padding-right: 5px; display: none; visibility: hidden">
				<h3 id="-nc3-error-header" style="margin-top: 5px; margin-bottom: 5px">Failed to execute nCaptcha.</h3>
				<p id="-nc3-error-text" style="margin-top: 5px; margin-bottom: 5px">
					Sorry about this. :/
					<br />
					Below is a debugging data matrix, send this to a developer! <br />
				</p>
				<center id="-nc3-error-img"></center>
			</div>
		</div>
	</body>
</html>
